/*
 * Copyright (C) 2014 Lucid Wolf
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.lucidhex.erfworld;

import com.lucidhex.LucidWorldTemplate;
import com.lucidhex.hex.LucidHexType;
import com.lucidhex.viewer.LucidIcon;
import java.awt.Color;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 *  
 * @author Lucid Wolf
 */
// this should probably be called from a Lucid World Default one i get 
public class ErfWorldDefaultTemplate implements LucidWorldTemplate{
    public static String NAME = "ErfWorld";

    @Override
    public String getName() {
        return NAME;
    }

    @Override
    public Map<String, LucidHexType> getDefaultHexTypes() {
        HashMap<String, LucidHexType> out = new HashMap<>();
        //City Hex
        LucidHexType aHexType = new LucidHexType("City");
        aHexType.setBackgroundColor(Color.GRAY);
        aHexType.setForegroundColor(Color.BLACK);
        aHexType.addAttribute("Name","Rubble");
        // <>< Need to add level resource
        // <>< Need to add wall resource
        // <>< Need to add tower resource/unit/improvement?
        out.put(aHexType.getTypeName(),aHexType);
        // Desert Hex
        aHexType = new LucidHexType("Desert");
        aHexType.setBackgroundColor(new Color(250, 230, 180));
        aHexType.setForegroundColor(new Color(200, 170, 160));
        out.put(aHexType.getTypeName(),aHexType);
        // Field Hex
        aHexType = new LucidHexType("Field");
        aHexType.setBackgroundColor(new Color(120, 240, 130));
        aHexType.setForegroundColor(new Color(60, 120, 60));
        try{
            String xml = new Scanner(getClass().getResourceAsStream("fieldSquiggle_01.svg")).useDelimiter("\\A").next();
            aHexType.addChild(new LucidIcon("FieldForeGround", xml));
        }catch(Exception e){}
        out.put(aHexType.getTypeName(),aHexType);
        // Forest Hex
        aHexType = new LucidHexType("Forest");
        aHexType.setBackgroundColor(new Color(60, 120, 60));
        aHexType.setForegroundColor(new Color(30, 60, 40));
        try{
            String xml = new Scanner(getClass().getResourceAsStream("treeSquiggle_01.svg")).useDelimiter("\\A").next();
            aHexType.addChild(new LucidIcon("ForestForeGround", xml));
        }catch(Exception e){}
        out.put(aHexType.getTypeName(),aHexType);
        // Lava Hex
        aHexType = new LucidHexType("Lava");
        aHexType.setBackgroundColor(Color.RED);
        aHexType.setForegroundColor(Color.YELLOW);
        try{
            String xml = new Scanner(getClass().getResourceAsStream("waterSquiggle_01.svg")).useDelimiter("\\A").next();
            aHexType.addChild(new LucidIcon("LavaForeGround", xml));
        }catch(Exception e){}
        out.put(aHexType.getTypeName(),aHexType);
        // Mountain Hex
        aHexType = new LucidHexType("Mountain");
        aHexType.setBackgroundColor(new Color(150, 50, 0));
        aHexType.setForegroundColor(Color.GRAY);
        try{
            String xml = new Scanner(getClass().getResourceAsStream("mountainSquiggle_01.svg")).useDelimiter("\\A").next();
            aHexType.addChild(new LucidIcon("MountainForeGround", xml));
        }catch(Exception e){}
        out.put(aHexType.getTypeName(),aHexType);
        // High Mountain Hex
        aHexType = new LucidHexType("High Mountain");
        aHexType.setBackgroundColor(Color.GRAY);
        aHexType.setForegroundColor(new Color(150, 50, 0));
        try{
            String xml = new Scanner(getClass().getResourceAsStream("mountainSquiggle_01.svg")).useDelimiter("\\A").next();
            aHexType.addChild(new LucidIcon("MountainForeGround", xml));
        }catch(Exception e){}
        out.put(aHexType.getTypeName(),aHexType);
        // Water Hex
        aHexType = new LucidHexType("Water");
        aHexType.setBackgroundColor(new Color(50, 50, 180));
        aHexType.setForegroundColor(new Color(160, 160, 180));
        out.put(aHexType.getTypeName(),aHexType);        
        try{
            String xml = new Scanner(getClass().getResourceAsStream("waterSquiggle_01.svg")).useDelimiter("\\A").next();
            aHexType.addChild(new LucidIcon("WaterForeGround", xml));
        }catch(Exception e){}
        return out;
    }

}
